<div id="PeopleTableContainer"></div>
<div class="addRecord"></div>
<script type="text/javascript">

    $(document).ready(function() {

        //Prepare jTable
        $('#PeopleTableContainer').jtable({
            title: 'Danh sách hồ sơ nhân viên',
            paging: true,
            pageSize: 15,
            pageSizeChangeArea: false,
            sorting: true,
            defaultSorting: 'HoTen DESC',
            actions: {
                listAction: '<?php echo base_url('admin/home/getList'); ?>',
                deleteAction: '<?php echo base_url('admin/home/deleteStaff'); ?>',
                createAction: '<?php echo base_url('admin/home/addStaff'); ?>',
                updateAction: '<?php echo base_url('admin/home/updateStaff'); ?>',
            },
            fields: {
                MaHoSo: {
                    key: true,
                    create: false,
                    edit: false,
                    list: true,
                    title: 'Mã hồ sơ',
                    width: '10%',
                    display: function(data) {
                        var $link = $('<a href="<?php echo base_url('admin/home/getDetail?staffId='); ?>' + data.record.MaHoSo + '" style="text-decoration: none;">' + data.record.MaHoSo + '</a>');
                        return $link;
                    }
                },
                HoTen: {
                    title: 'Ho Tên',
                    width: '20%',
                    display: function(data) {
                        var $link = $('<a href="<?php echo base_url('admin/home/getDetail?staffId='); ?>' + data.record.MaHoSo + '" style="text-decoration: none;">' + data.record.HoTen + '</a>');
                        return $link;
                    }

                },
                SoDienThoai: {
                    title: 'Số ĐT',
                    width: '15%'
                },
                EmailCaNhan: {
                    title: 'Email Cá Nhân',
                    visibility: 'hidden'

                },
                EmailCongTy: {
                    title: 'Email Cty',
                    
                    visibility: 'hidden'
                },
                DiaChiLienHe: {
                    title: 'Ðịa Chỉ',
                    
                    visibility: 'hidden'
                },
                NgayVaoCongTy: {
                    title: 'Ngày vào Cty',
                    
                    type: 'date',
                    visibility: 'hidden'

                },
                MaBoPhan: {
                    title: 'Bộ phận',
                    visibility: 'hidden',
                    options: '<?php echo base_url("/admin/home/bophan"); ?>',
                    
                    
                },
                MaLoaiHopDong: {
                    title: 'Loại hợp đồng',
                    visibility: 'hidden',
                    options: '<?php echo base_url("/admin/home/loaiHopDong"); ?>',

                },
                MaChucDanh: {
                    title: 'Chức danh',
                    width: '20%',
                    options: '<?php echo base_url("/admin/home/chucDanh"); ?>',
                },
                MaCongViec: {
                    title: 'Công viec',
                    visibility: 'hidden',
                    options: '<?php echo base_url("/admin/home/congViec"); ?>',

                },
                
            },
        });

        //Load person list from server
        $('#PeopleTableContainer').jtable('load');
        $('.addRecord').addRecordButton;

    });



</script>